import { map, showRouteProfile } from "@/core";
import { AirLine } from "@/core/MapElement/Airline";
import { getGUI } from "@/global/menu";
import GUI from "lil-gui";


const airlines:AirLine[]=[]
map.elements.forEach((e)=>{
  if(e instanceof AirLine){
    airlines.push(e)
  }
})


export function main() {
  const gui = getGUI('航线')
  const menu: any = {}
  let folder:GUI
  airlines.forEach(e => {
    menu[e.option.name] = () => {
      folder?.destroy()
      folder=gui.addFolder(e.option.name)
      folder.add(e,'show')
      folder.add({
        显示剖面(){
          showRouteProfile(e.option.name)
        }
      },'显示剖面')
      e.focus()
      
    }
    gui.add(menu,e.option.name)
  })
  
}
